// type SpaceType = "";

type Trim<T extends string> = T extends `${SpaceType}${infer R}`
  ? Trim<R>
  : T extends `${infer R}${SpaceType}`
  ? Trim<R>
  : T;
